package com.my.ddd_sample_collections.aggregate_change_tracking.repository_framework;


import lombok.Builder;
import lombok.experimental.SuperBuilder;

import java.util.HashMap;
import java.util.Map;

@SuperBuilder
public abstract class AggregateRootSupport extends DomainObjectSupport implements AggregateRoot {
    
    /**
     * key是tableName+主键
     */
    @Builder.Default
    private Map<String, Integer> poVersionMap = new HashMap<>();
    
    @Override
    public int getPersistenceObjectVersion(String key) {
        return poVersionMap.get(key);
    }
    @Override
    public void setPersistenceObjectVersions(Map<String, Integer> versionsMap) {
        this.poVersionMap = versionsMap;
    }
}
